package core.conditions;

import core.Named;

/**
 * Condition can be stepped and checked for completion
 * 
 * A condition is a context object.  It communicates some context
 * through its finished method.  All conditions are binary, but they
 * can be stacked to create more complex contexts.  When a condition
 * is stepped through it changes its state, which in somes cases will
 * change the context.
 * 
 * @version 1.0
 * @author Alexander Schearer <aas11@duke.edu>
 */
abstract public class Condition implements Named<Condition> {
	
	private String myName;
	
	public Condition(String name)
	{
		myName = name;
	}
	
	public String getName() {
		return myName;
	}

	public boolean equals(Condition i) {
		return myName.equals(i.getName());
	}

	public int compareTo(Condition o) {
		return myName.compareTo(o.getName());
	}
	
	abstract public void reset();
	
	abstract public void step();

	abstract public boolean finished();

}
